<div class="action-dialog-model-fixed-body">
    <div class="detailsBox">
        <h3>经营主体信息</h3>
        <form action="<@url value='/mainShopInfoRest/save'/>" method="post" name="shopForm" class="action-ajax-form action-ajax-form-valid" >
            <div class="detaiTab">
                <input id="id" type="hidden" value="${view.id}" name="id">
                <input id="loanapplyNo" type="hidden" value="${loanapplyNo}" name="loanapplyNo">

                <table width="100%" cellspacing="0" cellpadding="0" border="0">
                  <tbody>
                    <tr>
                        <td width="15%" align="right" class="bg">* 营业执照名称：<font color="red">*</font> </td>
                        <td >
                            <input  type="text" id="licenceName" value="${view.licenceName}"  size="30" name="licenceName" class="action-valid-field" data-action-valid-rule="required;maxlength:30;" data-action-valid-msg-required="营业执照名称不能为空！"  autocomplete="off" />
                            <span class="action-field-error" for="licenceName" style="color:red;"></span>
                        </td>
                        <td width="15%" align="right" class="bg">* 营业执照注册号：<font color="red">*</font> </td>
                        <td >
                            <input type="text"  id="blrNumber" value="${view.blrNumber}" size="30" name="blrNumber" class="action-valid-field" data-action-valid-rule="required;maxlength:30;" data-action-valid-msg-required="营业执照注册号不能为空！"  autocomplete="off" />
                            <span class="action-field-error" for="blrNumber" style="color:red;"></span>
                        </td>
                    </tr>
                     <tr>
                        <td width="15%" align="right" class="bg">* 组织形式：<font color="red">*</font> </td>
                        <td >
                            <@select dataSouceType="organizationForm" name="organizationForm"  value="${view.organizationForm}" class="action-valid-field" data\-action\-valid\-rule="required;" data\-action\-valid\-msg\-required="组织形式不能为空！" />
                            <span class="action-field-error" for="organizationForm" style="color:red;"></span>
                        </td>
                        <td width="15%" align="right" class="bg">* 注册时间：<font color="red">*</font> </td>
                        <td >
                        	<@date value="${view.stupdate}" id="stupdate" name="stupdate" class="action-valid-field" data\-action\-valid\-rule="required;" data\-action\-valid\-msg\-required="门店成立日期不能为空！" />
                            <span class="action-field-error" for="stupdate" style="color:red;"></span>
                        </td>
                    </tr>
                    
                    <tr>
                       <td width="15%" align="right" class="bg">* 营业执照地址：<font color="red">*</font> </td>
                        <td colspan="3">
                            <span id="yyzzdz"><@select dataSouceType="province" name="shopprovince"  id="select_shop_provinceId" value="${view.shopprovince}" onchange="shopprovinceOnchange()" />
                            &nbsp;&nbsp; <@select dataSouceType="city" dataSouceFrom="${view.shopprovince}" name="shopcity"  id="select_shop_cityId" value="${view.shopcity}" onchange="shopcityOnchange()" />
                            &nbsp;&nbsp; <@select dataSouceType="country" dataSouceFrom="${view.shopcity}" name="shopcounty"  id="select_shop_districtId" value="${view.shopcounty}"/>
                            &nbsp;&nbsp; <input type="text"  id="shopaddress" value="${view.shopaddress}" size="50" name="shopaddress" class="action-valid-field" data-action-valid-rule="required;maxlength:50;" data-action-valid-msg-required="营业执照地址不能为空！"  autocomplete="off" />
                            <span class="action-field-error" for="shopaddress" style="color:red;"></span>&nbsp;&nbsp;
                            <a href="javascript:void(0);" target="_blank" onclick="yyzzdzmap(this)">地图中查看</a>
                        </td>
                    </tr>
                    <tr>
                        <td width="15%" align="right" class="bg">办公地址: </td>
                        <td colspan='3'><span id="bgdz"><@select dataSouceType="province" name="officeprovince"  id="select_provinceId" value="${view.officeprovince}" onchange="provinceOnchange()" />
                            &nbsp;&nbsp; <@select dataSouceType="city" dataSouceFrom="${view.officeprovince}" name="officecity"  id="select_cityId"  value="${view.officecity}" onchange="cityOnchange()" />
                            &nbsp;&nbsp; <@select dataSouceType="country" dataSouceFrom="${view.officecity}" name="officecounty"  id="select_districtId" value="${view.officecounty}"/>
                            &nbsp;&nbsp; <input type="text"  id="officeaddress" value="${view.officeaddress}" size="50" name="officeaddress" class="action-valid-field" data-action-valid-rule="maxlength:50;"  autocomplete="off" />
                            <span class="action-field-error" for="officeaddress" style="color:red;"></span>&nbsp;&nbsp;
                            <a href="javascript:void(0);" target="_blank" onclick="bgdzmap(this);">地图中查看</a>
                        </td>
                    </tr>
                    
                    <tr>
                        <td width="15%" align="right" class="bg">股东人数/人：<font color="red">*</font> </td>
                        <td colspan="3">
                           	<input type="text"  id="shareholders" value="${view.shareholders}" size="10" name="shareholders" class="action-valid-field" data-action-valid-rule="required;maxlength:10;number;reg:^[1-9]\d*$;" data-action-valid-msg-required="股东人数不能为空！"  autocomplete="off" /> 人
                            <span class="action-field-error" for="shareholders" style="color:red;"></span>
                        </td>
                    </tr>    
                    
                    <tr>
						<td width="15%" align="right" class="bg">* 借款人夫妻占股比例(%)：<font color="red">*</font> </td>
                        <td >
                           	<input type="text"  id="shoprent" value="${view.shoprent}" size="10" name="shoprent" class="action-valid-field" data-action-valid-rule="required;maxlength:10;number;reg:^[1-9]\d*$;" data-action-valid-msg-required=" 借款人夫妻占股比例不能为空！"  autocomplete="off" />
                            <span class="action-field-error" for="shoprent" style="color:red;"></span>
                        </td>
                        <td width="15%" align="right" class="bg">* 工商查询是否异常：<font color="red">*</font> </td>
                        <td>
                        	<@select dataSouceType="GS_QUREY_ABNERMAL" dataSouceFrom="CRM" name="isAbnermal"
                       			 id="isAbnermal" value="${view.isAbnermal}" class="action-valid-field" 
                        		 data\-action\-valid\-rule="required;" data\-action\-valid\-msg\-required="工商查询是否异常不能为空！"/>
                            <span class="action-field-error" for="isAbnermal" style="color:red;"></span>
                        </td>
                    </tr>
                    
                    <tr>
                    	<td width="15%" align="right" class="bg">* 借款人是否为实际控制人：<font color="red">*</font> </td>
                        <td>
                            <@select dataSouceType="iscontroller" dataSouceFrom="CRM"  name="isLoadname"  value="${view.isLoadname}" 
                            	class="action-valid-field" data\-action\-valid\-rule="required;" data\-action\-valid\-msg\-required="借款人是否为实际控制人不能为空！"/>
                            <span class="action-field-error" for="isLoadname" style="color:red;"></span>
                        </td>
                        
                        <td width="15%" align="right" class="bg">* 实际控制人姓名：<font color="red">*</font> </td>
                        <td>
                            <input type="text"  id="controllername" value="${view.controllername}" size="30" name="controllername"  class="action-valid-field" data-action-valid-rule="required;maxlength:30;" data-action-valid-msg-required="实际控制人姓名不能为空！"  autocomplete="off" />
                            <span class="action-field-error" for="controllername" style="color:red;"></span>
                        </td>
                    </tr>
                    <tr>
              <!--          
                        <td width="15%" align="right" class="bg">全年税金(元)： </td>
                        <td>
                           	<input type="text" maxlength="10" id="taxMoney" value="${view.taxMoney}" size="30" name="taxMoney" class="action-valid-field" data-action-valid-rule="number;"  autocomplete="off" />
                            <span class="action-field-error" for="taxMoney" style="color:red;"></span>
                        </td>
               -->         
                        <td width="15%" align="right" class="bg">* 营业模式：<font color="red">*</font> </td>
                        <td colspan="3">
                        	<@select dataSouceType="businessModel" name="businessType"  value="${view.businessType}" class="action-valid-field" data\-action\-valid\-rule="required;" data\-action\-valid\-msg\-required="营业模式不能为空！" />
                            <span class="action-field-error" for="businessType" style="color:red;"></span>
                        </td>
                    </tr>
                    <tr>
                    	<td width="15%" align="right" class="bg">* 行业类别：<font color="red">*</font> </td>
                        <td>
                        	<@select dataSouceType="vocation_HYLB" name="vocation"  value="${view.vocation}" class="action-valid-field" data\-action\-valid\-rule="required;" data\-action\-valid\-msg\-required="行业类别不能为空！" />
                            <span class="action-field-error" for="vocation" style="color:red;"></span>
                        </td>
                    	<td width="15%" align="right" class="bg">* 经营起始时间 ：<font color="red">*</font> </td>
                        <td>
                        	<@date value="${view.businesshours}" id="businesshours" name="businesshours" class="action-valid-field" data\-action\-valid\-rule="required;" data\-action\-valid\-msg\-required="经营起始时间 不能为空！" />
                            <span class="action-field-error" for="businesshours" style="color:red;"></span>
                        </td>
                    </tr>
                    
                  </tbody>
                </table>
            </div>
            

            <div class="clearfix tac mtb20">
                <input type="submit" class="btn_auto_30 btn_blue" value="提交">&nbsp;
            </div>
        </form>

 
    </div>

    </div>
   <@js>
   
function bgdzmap(obj){
	var location = $('#bgdz').html().replace(/[\r\n &nbsp;]/g,'');
	obj.href='http://api.map.baidu.com/geocoder?address='+location+'&output=html&src=';
}

function mddzmap(obj){
	var location = $('#mddz').html().replace(/[\r\n &nbsp;]/g,'');
	obj.href='http://api.map.baidu.com/geocoder?address='+location+'&output=html&src=';
}

function yyzzdzmap(obj){
	var location = $('#yyzzdz').html().replace(/[\r\n &nbsp;]/g,'');
	obj.href='http://api.map.baidu.com/geocoder?address='+location+'&output=html&src=';
}
   
	$(function() {
		var loanType = $('#loanType').val();
		var sdurl = '/oaoro2odatasub/jsonword';
		if(loanType=='BP'||loanType=='BP_JX'||loanType=='SG'||loanType=='YC'||loanType=='SC'){
			var sdurl = '/oaoro2odatasub/jsonwordNew';
		}
		$('#shopnameRead').combogrid({
				loadMsg:'数据加载中,请稍后...',
				panelWidth: 500,
				idField: 'cno',
				textField: 'cname',
				url: sdurl,
				method: 'get',
				 rownumbers:true,//序号   
		      collapsible:false,//是否可折叠的   
				columns: [[
					{field:'cno',title:'流水号',width:80},
					{field:'ccode',title:'客户sd号',width:120},
					{field:'cname',title:'客户名简称',width:150},
					{field:'cnames',title:'客户全称',width:150}
				]],
				fitColumns: true,
				delay: 1100,
				keyHandler: {
					up: function() {
					},
					down: function() {
					},
					enter: function() {
					},
					query: function(q) {
						if(loanType=='BK'){
							$('#shopnameRead').combogrid("grid").datagrid("reload", { 'reloadname': q });
								$('#shopnameRead').combogrid("setValue", q);
						}else{
							if(q||q.length>3){
								$('#shopnameRead').combogrid("grid").datagrid("reload", { 'reloadname': q });
								$('#shopnameRead').combogrid("setValue", q);
								item=true;
							}
						}
					}
				 },
				 onClickRow:function(rowIndex, rowData){
					$("#shopname").val(rowData.cname);
					$("#shopno").val(rowData.cno);
					$("#shopcode").val(rowData.ccode);
				},
				onLoadSuccess:function(){
				}
			});
		})

   provinceOnchange();
        function provinceOnchange(){
        var provinceCode = $("#select_provinceId").val();
        var url="<@url value='/common/findCityByProvinceCode' domain='${crmUrl}'/>";
        $.ajax({
        type: "GET",
        url:url,
        data:{provinceCode:provinceCode},
        dataType:"jsonp",
        jsonp:"_callback",
        success:function(result){
   var t = $("#select_cityId").find("option:selected").text();
        $("#select_cityId").empty();
        $("#select_cityId").append("<option value=''>请选择</option>");

        $.each(result.data,function(key,value){
   if(t==value[1]){
   $("#select_cityId").append("<option selected = 'selected' value='"+value[0]+"'>"+value[1]+"</option>");
   }else{
   $("#select_cityId").append("<option value='"+value[0]+"'>"+value[1]+"</option>");
   }
        });
        }
        });
   cityOnchange();
        }


        function cityOnchange(){
        var cityCode = $("#select_cityId").val();
        var url="<@url value='/common/findDistrictByCityCode' domain='${crmUrl}'/>";
        $.ajax({
        type: "GET",
        url:url,
        data:{cityCode:cityCode},
        dataType:"jsonp",
        jsonp:"_callback",
        success:function(result){
   var t = $("#select_districtId").find("option:selected").text();
        $("#select_districtId").empty();
        $("#select_districtId").append("<option value=''>请选择</option>");

        $.each(result.data,function(key,value){
   if(t==value[1]){
   $("#select_districtId").append("<option selected = 'selected' value='"+value[0]+"'>"+value[1]+"</option>");
   }else{
   $("#select_districtId").append("<option value='"+value[0]+"'>"+value[1]+"</option>");
   }
        });
        }
        });
        }

        function shopprovinceOnchange(){
        var provinceCode = $("#select_shop_provinceId").val();
        var url="<@url value='/common/findCityByProvinceCode' domain='${crmUrl}'/>";
        $.ajax({
        type: "GET",
        url:url,
        data:{provinceCode:provinceCode},
        dataType:"jsonp",
        jsonp:"_callback",
        success:function(result){
   var t = $("#select_shop_cityId").find("option:selected").text();
        $("#select_shop_cityId").empty();
        $("#select_shop_cityId").append("<option value=''>请选择</option>");

        $.each(result.data,function(key,value){
   if(t==value[1]){
   $("#select_shop_cityId").append("<option selected = 'selected' value='"+value[0]+"'>"+value[1]+"</option>");
   }else{
   $("#select_shop_cityId").append("<option value='"+value[0]+"'>"+value[1]+"</option>");
   }
        });
        }
        });
   shopcityOnchange();
        }


        function shopcityOnchange(){
        var cityCode = $("#select_shop_cityId").val();
        var url="<@url value='/common/findDistrictByCityCode' domain='${crmUrl}'/>";
        $.ajax({
        type: "GET",
        url:url,
        data:{cityCode:cityCode},
        dataType:"jsonp",
        jsonp:"_callback",
        success:function(result){
   var t = $("#select_shop_districtId").find("option:selected").text();
        $("#select_shop_districtId").empty();
        $("#select_shop_districtId").append("<option value=''>请选择</option>");

        $.each(result.data,function(key,value){
   if(t==value[1]){
   $("#select_shop_districtId").append("<option selected = 'selected' value='"+value[0]+"'>"+value[1]+"</option>");
   }else{
   $("#select_shop_districtId").append("<option value='"+value[0]+"'>"+value[1]+"</option>");
   }
        });
        }
        });
        }

        $(function(){
        //1.配偶情况

        var shoptype=$("#shoptype").val();

        if(shoptype == 'MAN' ){
        $('#all_amount').show();
        $("input[name='totalAmount']").attr('data-action-valid-rule','required;');
        }else{
        $('#all_amount').hide();
        $("input[name='totalAmount']").removeAttr('data-action-valid-rule');
        }
        });

        $("#shoptype").change(function(){
        var shoptype=$("#shoptype").val();
        if(shoptype == 'MAN' ){
        $('#all_amount').show();
        $("input[name='totalAmount']").attr('data-action-valid-rule','required;');
        }else{
        $('#all_amount').hide();
        $("input[name='totalAmount']").removeAttr('data-action-valid-rule');
        }
        });
    </@js>
    <@jsRender/>